<template>
  <div class="contact-container">
    <div class="contact-item" v-for="(item, index) in list" :key="index">
      <div class="contact-icon"><xyIcon :type="item.icon"></xyIcon></div>
      {{ item.title }}
      <div v-if="item.src" class="contact-img-container">
        <div class="contact-img">
          <img :src="item.src" alt="" />
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import xyIcon from '@/components/xyIcon.vue'
export default {
  components: {
    xyIcon,
  },
  props: {
    list: {
      type: Array,
      default: Array,
    },
  },
}
</script>

<style scoped>
.contact-container {
  display: flex;
  flex-direction: column;
}
.contact-item {
  display: flex;
  height: 32px;
  line-height: 32px;
  color: #666666;
  padding-left: 15px;
  align-items: center;
  font-size: 14px;
  margin: 5px 0;
  cursor: pointer;
  position: relative;
}
.contact-icon {
  height: 24px;
  width: 24px;
  border-radius: 50%;
  background-color: #999999;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 10px;
  color: #333;
}
.contact-item:hover {
  color: #fff;
}
.contact-img-container {
  width: 120px;
  height: 0;
  position: absolute;
  bottom: 28px;
  overflow: hidden;
  transition: 500ms;
  left: 40px;
}
.contact-item:hover > .contact-img-container {
  height: 130px;
}
.contact-item:hover > .contact-icon {
  color: #fff;
}
.contact-img {
  width: 120px;
  height: 120px;
  border-radius: 4px;
  position: relative;
  background-color: #fff;
}
.contact-img::after {
  content: '';
  display: block;
  z-index: 10;
  position: absolute;
  border-style: solid;
  border-width: 8px;
  bottom: -15px;
  left: 50px;
  border-color: #fff transparent transparent transparent;
}
.contact-img img {
  width: calc(100% - 16px);
  height: calc(100% - 16px);
  margin: 8px;
}
</style>
